package test;

import java.text.DecimalFormat;
import dao.impl.CaseHistoryDaoImpl;
import entity.CaseHistory;
import util.DataCountUtil;
import util.DateUtil;
 
public class Main {

//public static void main(String[] args) {
//    Doctor doctor = new Doctor();
//    doctor.setId("210001");
//    doctor.setPwd("5555");
//    doctor.setName("sdf");
//    doctor.setTel("18341475222");
//    doctor.setSex("男");
//    doctor.setEdu("本科");
//    doctor.setJoindate(new Date());
//    doctor.setAdmincheck("0");
//    doctor.setOther("个人介绍");
//    doctor.setPicture("/data/doctor/photo/21001.jpg");
//    doctor.setPost("主任");
//    doctor.setEmail("18341475214@qq.com");
//    DoctorDaoImpl doctorDao = new DoctorDaoImpl();
//    int i = 0 ;
////    i = doctorDao.add(doctor);
////    i = doctorDao.delete(doctor.getId());
//    i=doctorDao.update(doctor);
//    List<Doctor> list=doctorDao.getAllDoctor();
//    List<Doctor> list1=doctorDao.getByDoctorId("210381193610300011");
//    System.out.println(list);
//    System.out.println(list1);
//    System.out.println(i);
//}
//public static void main(String[] args) {
//    CaseHistory caseHistory = new CaseHistory(
//            "210381202004100010002","2020-04-10","210001","2111","发热、干咳、头痛","血液检验A","/路径.jpg",
//            "流行性感冒","药物治疗+输液","感康胶囊","清淡饮食",0
//    );
//    CaseHistoryDaoImpl caseHistoryDao = new CaseHistoryDaoImpl();
//    int i = 0;
//    System.out.println(caseHistoryDao.getAllCaseHistory());
//    i=caseHistoryDao.add(caseHistory);
//    System.out.println(i);
//    System.out.println(caseHistoryDao.getAllCaseHistory());
//    i=caseHistoryDao.delete(caseHistory.getCh_number());
//    System.out.println(i);
//    System.out.println(caseHistoryDao.getAllCaseHistory());
//}
//public static void main(String[] args) {
//    PatientDaoImpl patientDao = new PatientDaoImpl();
////    System.out.println(patientDao.getAllPatient().toString());
//    try{
//        patientDao.getByPatientId("21038119840921001").get(0);
//    }catch (Exception e){
//
//    }
//    System.out.println();
////    System.out.println(patientDao.getByPatientId("210381198409210011"));
////    Patient patient = new Patient("112211",0,"2","3","12","32","1232123123","123123123");
////    patientDao.add(patient);
////    System.out.println(patientDao.getByPatientId(patient.getID()));
////    patientDao.delete(patient.getID());
////    System.out.println(patientDao.getByPatientId(patient.getID()));
//    System.out.println(DateUtil.getStringDate());
//    System.out.println(DateUtil.getNowDate());
//    System.out.println(DateUtil.strToDateLong(DateUtil.getStringDate()));
//    System.out.println(DateUtil.strToDate("2020-04-28"));
//    String id="210381200201155317";
//    String birthday =id.substring(6, 14);
//    System.out.println(birthday);
//    birthday = birthday.substring(0,4)+"-"+birthday.substring(4,6)+"-"+birthday.substring(6,8);
//    System.out.println(birthday);
//    System.out.println(DateUtil.getStringDateShort());
//    System.out.println(DateUtil.ShortStrToDate(birthday));
//    long age = DateUtil.getDays(DateUtil.getStringDateShort(),birthday);
//    age /=365;
//    System.out.println(age);
//}
//public static void main(String[] args) {
//    String id = "210381200201155317";
//    int flag = 1;//自定运行状态码，初始为1：正常，由数据库查询未找到病人错误：0，
//    Patient patient = new Patient();
//    PatientDaoImpl patientDao = new PatientDaoImpl();
//    CaseHistoryDaoImpl caseHistoryDao = new CaseHistoryDaoImpl();
//    PatientBaseInfo patientBaseInfo = new PatientBaseInfo();
//    try {
//        patient = patientDao.getByPatientId(id).get(0);
//        patientBaseInfo = GetPatientIdInfo.base(id);//
//        patientBaseInfo.setName(patient.getName());
//        patientBaseInfo.setFistTime(caseHistoryDao.getByPatientIdOrderByDate(id).get(0).getCh_date());
//        patientBaseInfo.setTel(patient.getTel_Number());
//        patientBaseInfo.setFamilyName(patient.getFamily_Name());
//        patientBaseInfo.setFlag(flag);
//        patientBaseInfo.setMsg("病人信息存在，请录入病历");
//        System.out.println(patientBaseInfo.toString());
//    } catch (Exception e) {
//        flag = 0;
//        patientBaseInfo = GetPatientIdInfo.base(id);
//        patientBaseInfo.setFistTime(DateUtil.getStringDate());
//        patientBaseInfo.setFlag(flag);
//        patientBaseInfo.setMsg("病人信息不存在，请继续录入");
//        System.out.println(patientBaseInfo.toString());
//        }
//}
//public static void main(String[] args) {
//    CaseHistoryDaoImpl caseHistoryDao = new CaseHistoryDaoImpl();
//    System.out.println(NumberCreateUtil.chNumber("001"));

//    System.out.println(GetInitPwdById.Get("210381200201155317"));
//    System.out.println(DataCountUtil.doctorData("210001").get(0).getCh_number());
//    System.out.println(a);
//    String listCount = "";
////        int n = 0;
//    int hospitalized = 0;//住院
//    String name = "";//最高发疾病
//    int number = 0;
//    int cure = 0;//治愈
//    String scope = "";//范围
//    int number2 = 0;
//    String id = "210001";
//    Map params = new HashMap();
//    Map dict = new HashMap();
//    params.put("key", "values");
//    params.put("key2", "values2");
//
//    CaseHistoryDaoImpl caseHistoryDao = new CaseHistoryDaoImpl();
//    List<String> list = new ArrayList<String>();
//    List<String> list1 = new ArrayList<String>();
//    List<CaseHistory> listch = caseHistoryDao.getAllCaseHistory();
//    list.add("流行性感冒");
//
//
//    for (int i = 0; i < listch.size(); i++) {
//        list1.add(listch.get(i).getCh_clinicaldiagnosis());
//        if ("1".equals(listch.get(i).getCh_hospitalization())) {
//            hospitalized += hospitalized;
//        }
//
//
//        if (list.indexOf(listch.get(i).getCh_clinicaldiagnosis()) == -1) {
//            list.add(listch.get(i).getCh_clinicaldiagnosis());
//
////            params.put(listch.get(i).getCh_clinicaldiagnosis(),"values");
//
//        }
//    }
//    int a = Collections.frequency(list1, "流行性感冒");
//System.out.println(a);
//System.out.println(list);
//
//public static void main(String[] args) {
//    int num;
//    int num1 = 0;
//    String name;
//    String name1 = "";
//    List<String> list = new ArrayList<String>();//不重复疾病表
////    list.add("感冒");
////    list.add("感冒");
////    list.add("头痛");
////    list.add("发烧");
//    CaseHistoryDaoImpl caseHistoryDao = new CaseHistoryDaoImpl();
//    List<String> list1 = new ArrayList<String>();//全部疾病
//    List<CaseHistory> listDatech = caseHistoryDao.getByDoctorId("210001");//数据库病历表
//
//    for (int i = 0; i < listDatech.size(); i++) {//
//
//        list1.add(listDatech.get(i).getCh_clinicaldiagnosis());
//
//    }
//    list = list1.stream().distinct().collect(Collectors.toList());
//    for (int i = 0; i < list.size(); i++) {
//
//        name = list.get(i);
//        num = DataCountUtil.count(name, list1);
//
//        if (num1 < num) {
//            num1 = num;
//            name1 = name;
//        }
//
//
//    }
//    System.out.println(name1 + ":" + num1);
//}
public static void main(String[] args) {



}
}
